package com.central.apps.dao.inspection;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;
@Mapper
public interface inspcontenDao {
    @Select("SELECT c.assetnum AS assetnum,c.assetdesc AS assetdesc,c.inspnum AS inspnum,c.inspdesc AS inspdesc \n" +
            "FROM gq_inspregion a \n" +
            "LEFT JOIN gq_insparealocation b ON a.insaenum = b.insaenum\n" +
            "LEFT JOIN gq_insparealine c ON b.id = c.insplocid\n" +
            "WHERE a.insaenum = #{insaenum}")
    List<Map<String, Object>> getInspplanHandler(@Param("insaenum") String insaenum);
    @Insert("INSERT INTO gq_insptstand (insptareaid,assetnum,assetdesc,inspnum,inspdesc) VALUES(#{map.insptareaid},#{map.assetnum},#{map.assetdesc},#{map.inspnum},#{map.inspdesc})")
    int insert(@Param("map") Map<String, Object> map);


    /**
     * 查今日需要生成的定时任务
     */
    @Select("select * from gq_inspplan where nextexecutedate = #{nextexecutedate}")
    List<Map<String, Object>> findInspplanList(@Param("nextexecutedate") String dateStr);

    @Select("SELECT * FROM gq_inspcontent WHERE inspnum = #{inspnum}")
    List<Map<String, Object>> getIncontentHandler(@Param("inspnum") String inspnum);
    @Insert("INSERT INTO gq_instaskcont (insptstandid,inspcont,inspstan,inspperson,inspperdesc,createtime) VALUES(#{map.insptstandid},#{map.inspcont},#{map.inspstan},#{map.inspperson},#{map.inspperdesc},#{map.createtime})")
    int insertt(@Param("map") Map<String, Object> map);
}
